home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 8
/
Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO
/
047a
/
probots.arj
/
MT_FUJI.PR
< prev
next >
Wrap
Text File
|
1988-11-05
|
3KB
|
99 lines
PROCEDURE MT_FUJI;
{ Fuji-yama is the most famous mountain in Japan. }
{ Based on a C-Robot by Hortense Endoh }
VAR
dir, deg, Range, spd, last_D : Integer;
FUNCTION Hurt : Boolean;
{Checks if robot has incurred any new damage}
{Added by David Malmberg}
VAR Curr_D : Integer;
Answer : Boolean;
BEGIN
Curr_D := damage;
IF Curr_D > last_D
THEN Answer := True
ELSE Answer := False;
last_D := Curr_D;
IF Answer THEN
BEGIN
drive(dir, 0); {slow down}
WHILE speed >= 50 DO {nothing - keep slowing down} ;
dir := dir+180; {reverse direction and run away}
drive(dir, spd)
END;
Hurt := Answer;
END;
PROCEDURE shoot;
BEGIN
drive(dir, spd);
Range := scan(deg, 10);
IF (Range > 40)
THEN cannon(deg, Range)
ELSE
BEGIN
deg := deg+20;
Range := scan(deg, 10);
IF (Range = 0) THEN
BEGIN
deg := deg-40;
Range := scan(deg, 10);
IF (Range = 0) THEN
BEGIN
deg := deg+60;
Range := scan(deg, 10);
WHILE (Range = 0) AND (NOT Hurt) DO
BEGIN
deg := deg+20;
Range := scan(deg, 10);
END;
END;
END;
IF (Range > 40) THEN cannon(deg, Range);
END;
END; {shoot}
PROCEDURE init_proc;
BEGIN
last_D := damage;
dir := 270;
spd := 100;
WHILE (loc_y > 150) AND (NOT Hurt) DO shoot;
dir := 90;
shoot;
shoot;
shoot;
dir := 180;
WHILE (loc_x > 100) AND (NOT Hurt) DO shoot;
dir := 0;
WHILE (loc_x < 900) AND (NOT Hurt) DO shoot;
END; {init-proc}
BEGIN {Mt_Fuji Main}
init_proc;
REPEAT
dir := 105; WHILE (loc_y < 900) AND (NOT Hurt) DO shoot;
dir := 255; shoot;
dir := 0; WHILE (loc_x < 550) AND (NOT Hurt) DO shoot;
dir := 180; shoot;
dir := 285; WHILE (loc_y > 100) AND (NOT Hurt) DO shoot;
dir := 105; shoot;
dir := 0; WHILE (loc_x < 900) AND (NOT Hurt) DO shoot;
dir := 180; shoot;
dir := 105; WHILE (loc_y < 900) AND (NOT Hurt) DO shoot;
dir := 285; shoot;
dir := 180; WHILE (loc_x > 450) AND (NOT Hurt) DO shoot;
dir := 0; shoot;
dir := 255; WHILE (loc_y > 100) AND (NOT Hurt) DO shoot;
dir := 75; shoot;
dir := 180; WHILE (loc_x > 100) AND (NOT Hurt) DO shoot;
dir := 0; shoot;
UNTIL Dead OR Winner;
END; {Mt_Fuji Main}